home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2002 #11
/
Amiga Plus CD - 2002 - No. 11.iso
/
amigaoscd
/
amigapluscd
/
AP-Website
/
news
/
admin
/
phpmyadmin
/
extchg.sh
< prev
next >
Wrap
Linux/UNIX/POSIX Shell Script
|
2002-01-27
|
916b
|
42 lines
#!/bin/sh
# original php3->phtml converter by Pavel Piankov <pashah@spb.sitek.net>
# modified by Tobias Ratschiller to allow any file extension
# part of the phpMyAdmin distribution <http://phpwizard.net/phpMyAdmin>
if [$1 eq ""]
then
echo "Missing first parameter (extension to be changed)"
echo "Usage: extchg <extension to change from> <extension to change to>"
exit
fi
if [$2 eq ""]
then
echo "Missing second parameter (extension to change to)"
echo "Usage: extchg <extension to change from> <extension to change to>"
exit
fi
if test ! -s *.$1
then
echo 'Nothing to convert! Try to copy the script to the directory where you have files to convert.'
exit
fi
if test ! -d bak
then
mkdir bak
else
echo 'Directory bak is already there - will try to use it to backup your files...'
fi
for i in *.$1
do
sed -e 's/'$1'/'$2'/g' $i > `ls $i|sed -e 's/'$1'/'$2'/g'`
mv $i bak/$i
done;